<!DOCTYPE html>
<html lang="en">
  <head>
    <title>SFFocusViewLayout Class Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset='utf-8'>
    <script src="../js/jquery.min.js" defer></script>
    <script src="../js/jazzy.js" defer></script>
    
  </head>
  <body>
    <a name="//apple_ref/swift/Class/SFFocusViewLayout" class="dashAnchor"></a>
    <a title="SFFocusViewLayout Class Reference"></a>
    <header>
      <div class="content-wrapper">
        <p><a href="../index.html">SFFocusViewLayout Docs</a> (100% documented)</p>
      </div>
    </header>
    <div class="content-wrapper">
      <p id="breadcrumbs">
        <a href="../index.html">SFFocusViewLayout Reference</a>
        <img id="carat" src="../img/carat.png" />
        SFFocusViewLayout Class Reference
      </p>
    </div>
    <div class="content-wrapper">
      <nav class="sidebar">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a href="../Classes.html">Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Classes/SFFocusViewLayout.html">SFFocusViewLayout</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">
        <section>
          <section class="section">
            <h1>SFFocusViewLayout</h1>
              <div class="declaration">
                <div class="language">
                  <pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">SFFocusViewLayout</span><span class="p">:</span> <span class="kt">UICollectionViewLayout</span></code></pre>

                </div>
              </div>
            <p><code>SFFocusViewLayout</code> is a subclass of <code>UICollectionViewLayout</code>
for displaying focused content on UICollectionView which is
the largest cell of all.</p>

<p>By default, this UICollectionViewLayout has initialize a set
of properties to work as designed.</p>

          </section>
          <section class="section task-group-section">
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:vC17SFFocusViewLayout17SFFocusViewLayout14standardHeightV12CoreGraphics7CGFloat"></a>
                    <a name="//apple_ref/swift/Property/standardHeight" class="dashAnchor"></a>
                    <a class="token" href="#/s:vC17SFFocusViewLayout17SFFocusViewLayout14standardHeightV12CoreGraphics7CGFloat">standardHeight</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Standard height for collapsed cells.</p>

<p>By default, this property is set to <code>100</code>.</p>

<div class="aside aside-parameter">
    <p class="aside-title">Parameter</p>
    Parameter standardHeight:     The collapsed height

</div>

<div class="aside aside-warning">
    <p class="aside-title">Warning</p>
    this property must be smaller than focusedHeight

</div>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">@IBInspectable</span> <span class="kd">public</span> <span class="k">var</span> <span class="nv">standardHeight</span><span class="p">:</span> <span class="kt">CGFloat</span> <span class="o">=</span> <span class="mi">100</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>standardHeight</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The collapsed height</p>

                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:vC17SFFocusViewLayout17SFFocusViewLayout13focusedHeightV12CoreGraphics7CGFloat"></a>
                    <a name="//apple_ref/swift/Property/focusedHeight" class="dashAnchor"></a>
                    <a class="token" href="#/s:vC17SFFocusViewLayout17SFFocusViewLayout13focusedHeightV12CoreGraphics7CGFloat">focusedHeight</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">@IBInspectable</span> <span class="kd">public</span> <span class="k">var</span> <span class="nv">focusedHeight</span><span class="p">:</span> <span class="kt">CGFloat</span> <span class="o">=</span> <span class="mi">280</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>focusedHeight</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The expanded height</p>

                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:vC17SFFocusViewLayout17SFFocusViewLayout10dragOffsetV12CoreGraphics7CGFloat"></a>
                    <a name="//apple_ref/swift/Property/dragOffset" class="dashAnchor"></a>
                    <a class="token" href="#/s:vC17SFFocusViewLayout17SFFocusViewLayout10dragOffsetV12CoreGraphics7CGFloat">dragOffset</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Drag Offset is the amount the user needs to scroll before
the featured cell changes.</p>

<p>By default, this property is set to <code>180</code>.</p>

<div class="aside aside-parameter">
    <p class="aside-title">Parameter</p>
    Parameter dragOffset:    The amount user needs to change cell

</div>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">@IBInspectable</span> <span class="kd">public</span> <span class="k">var</span> <span class="nv">dragOffset</span><span class="p">:</span> <span class="kt">CGFloat</span> <span class="o">=</span> <span class="mi">180</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>dragOffset</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The amount user needs to change cell</p>

                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:FC17SFFocusViewLayout17SFFocusViewLayout25collectionViewContentSizeFS0_FT_VSC6CGSize"></a>
                    <a name="//apple_ref/swift/Method/collectionViewContentSize()" class="dashAnchor"></a>
                    <a class="token" href="#/s:FC17SFFocusViewLayout17SFFocusViewLayout25collectionViewContentSizeFS0_FT_VSC6CGSize">collectionViewContentSize()</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Return the size of all the content in the collection view</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="k">override</span> <span class="kd">public</span> <span class="kd">func</span> <span class="nf">collectionViewContentSize</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt">CGSize</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:FC17SFFocusViewLayout17SFFocusViewLayout37shouldInvalidateLayoutForBoundsChangeFS0_FVSC6CGRectSb"></a>
                    <a name="//apple_ref/swift/Method/shouldInvalidateLayoutForBoundsChange(_:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:FC17SFFocusViewLayout17SFFocusViewLayout37shouldInvalidateLayoutForBoundsChangeFS0_FVSC6CGRectSb">shouldInvalidateLayoutForBoundsChange(_:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Return true so that the layout is continuously invalidated as the user scrolls</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="k">override</span> <span class="kd">public</span> <span class="kd">func</span> <span class="nf">shouldInvalidateLayoutForBoundsChange</span><span class="p">(</span><span class="nv">newBounds</span><span class="p">:</span> <span class="kt">CGRect</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:FC17SFFocusViewLayout17SFFocusViewLayout43targetContentOffsetForProposedContentOffsetFS0_FTVSC7CGPoint21withScrollingVelocityS1__S1_"></a>
                    <a name="//apple_ref/swift/Method/targetContentOffsetForProposedContentOffset(_:withScrollingVelocity:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:FC17SFFocusViewLayout17SFFocusViewLayout43targetContentOffsetForProposedContentOffsetFS0_FTVSC7CGPoint21withScrollingVelocityS1__S1_">targetContentOffsetForProposedContentOffset(_:withScrollingVelocity:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Return the content offset of the nearest cell which achieves the nice snapping effect, similar to a paged UIScrollView</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="k">override</span> <span class="kd">func</span> <span class="nf">targetContentOffsetForProposedContentOffset</span><span class="p">(</span><span class="nv">proposedContentOffset</span><span class="p">:</span> <span class="kt">CGPoint</span><span class="p">,</span> <span class="n">withScrollingVelocity</span> <span class="nv">velocity</span><span class="p">:</span> <span class="kt">CGPoint</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">CGPoint</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:FC17SFFocusViewLayout17SFFocusViewLayout33layoutAttributesForElementsInRectFS0_FVSC6CGRectGSqGSaCSo32UICollectionViewLayoutAttributes__"></a>
                    <a name="//apple_ref/swift/Method/layoutAttributesForElementsInRect(_:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:FC17SFFocusViewLayout17SFFocusViewLayout33layoutAttributesForElementsInRectFS0_FVSC6CGRectGSqGSaCSo32UICollectionViewLayoutAttributes__">layoutAttributesForElementsInRect(_:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Return all attributes in the cache whose frame intersects with the rect passed to the method</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="k">override</span> <span class="kd">public</span> <span class="kd">func</span> <span class="nf">layoutAttributesForElementsInRect</span><span class="p">(</span><span class="nv">rect</span><span class="p">:</span> <span class="kt">CGRect</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">UICollectionViewLayoutAttributes</span><span class="p">]?</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:FC17SFFocusViewLayout17SFFocusViewLayout13prepareLayoutFS0_FT_T_"></a>
                    <a name="//apple_ref/swift/Method/prepareLayout()" class="dashAnchor"></a>
                    <a class="token" href="#/s:FC17SFFocusViewLayout17SFFocusViewLayout13prepareLayoutFS0_FT_T_">prepareLayout()</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Perform whatever calculations are needed to determine the position of the cells and views in the layout</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="k">override</span> <span class="kd">public</span> <span class="kd">func</span> <span class="nf">prepareLayout</span><span class="p">()</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:FC17SFFocusViewLayout17SFFocusViewLayout34layoutAttributesForItemAtIndexPathFS0_FCSo11NSIndexPathGSqCSo32UICollectionViewLayoutAttributes_"></a>
                    <a name="//apple_ref/swift/Method/layoutAttributesForItemAtIndexPath(_:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:FC17SFFocusViewLayout17SFFocusViewLayout34layoutAttributesForItemAtIndexPathFS0_FCSo11NSIndexPathGSqCSo32UICollectionViewLayoutAttributes_">layoutAttributesForItemAtIndexPath(_:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Returns the layout attributes for the item at the specified index path.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="k">override</span> <span class="kd">public</span> <span class="kd">func</span> <span class="nf">layoutAttributesForItemAtIndexPath</span><span class="p">(</span><span class="nv">indexPath</span><span class="p">:</span> <span class="kt">NSIndexPath</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">UICollectionViewLayoutAttributes</span><span class="p">?</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </section>
        </section>
        <section id="footer">
          <p>&copy; 2016 <a class="link" href="https://github.com/fdzsergio/SFFocusViewLayout" target="_blank" rel="external">Sergio Fernández</a>. All rights reserved. (Last updated: 2016-01-30)</p>
          <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
        </section>
      </article>
    </div>
  </body>
</div>
</html>
